package com.hoshiicloud.saleorder.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.saleorder.entity.OrderInfo;
import java.util.List;
import java.util.Map;

import com.hoshiicloud.saleorder.entity.OrderMain;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 订单信息 服务类
 * </p>
 *
 * @author zhangshuhu
 * @since 2019-06-03
 */
@Service
public interface OrderInfoService extends IService<OrderInfo> {

    OrderInfo getById(Long id);

    @Override
    boolean save(OrderInfo entity);

    @Override
    boolean updateById(OrderInfo entity);

    IPage<OrderInfo> page(IPage<OrderInfo> page, Wrapper<OrderInfo> queryWrapper, String key);

    boolean deleteById(Long id);

    List<OrderInfo> getByIds(List<Long> ids, String key);

    List<OrderInfo> listByOrderId(Long orderId);

    List<OrderInfo> listByPayOrderId(Long payOrderId);

    List<OrderInfo> listByQueryWrapper(QueryWrapper<OrderInfo> queryWrapper);

    boolean updateByList(List<OrderInfo> orderInfoList);

    List<Map<String, Object>> multiConditionBranchOrders(Map<String, Object> branchOrderQueryParam, Page page);

    List<Map<String, Object>> multiConditionBranchOrders(Map<String, Object> branchOrderQueryParam);

    String selectBaseSpuCategoryId(String categoryId);

    /**
     * 根据扩展spu主键组查询销售数量
     * @param wrapper 查询条件
     * @return List<Map<String, Object>>
     */
    List<Map<String, Object>> selectSalesCountBySpuIds(QueryWrapper<OrderInfo> wrapper);

    /**
     * 根据总店分组查询已售数量
     * @param wrapper 查询参数
     * @return List<Map<String, Object>>
     */
    List<Map<String, Object>> selectSalesCountGroupByStorePid(QueryWrapper<OrderInfo> wrapper);

    /**
     * 按店铺分组获取店铺粉丝数和购买指数
     * @param queryWrapper 查询参数
     * @return List<Map<String,Object>>
     */
    List<Map<String,Object>> getStoreFansAndBuyExponentGroupById(QueryWrapper<OrderInfo> queryWrapper);

    List<OrderInfo> listByMainId(Long mainId);

    /**
     * 根据自定义条件查询商品子单信息
     */
    List<OrderInfo> omniQueryOrderMain(List<OmnipotentWrapper> wrappers, String key);
}
